package cn.dengta.webapp.user.entity;

import java.util.Date;

import cn.dengta.common.model.Status;
import cn.dengta.webapp.base.entity.BaseEntity;
import cn.dengta.webapp.user.model.ChannelType;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import me.codeplayer.util.StringUtil;
import me.codeplayer.util.X;

/**
 * 招募广告
 *
 * @author lgy
 * @since 2022-12-16
 */
@Setter
@Getter
@Accessors(chain = true)
@TableName("dt_recruit_ad")
public class RecruitAd extends BaseEntity {

	/** 广告ID */
	String adId;
	/** 渠道 */
	ChannelType channel;
	/** 代理商 */
	String merchant;
	/** 状态 */
	Integer status;
	/** 添加时间 */
	Date addTime;

	public RecruitAd init(RecruitAd input, Date now) {
		this.adId = X.expectNotNull(input.adId, adId);
		this.channel = X.expectNotNull(channel, input.channel);
		this.merchant = StringUtil.toString(input.merchant);
		this.status = Status.YES.value;
		this.addTime = now;
		return this;
	}

	public static final String AD_ID = "ad_id";
	public static final String CHANNEL = "channel";
	public static final String MERCHANT = "merchant";
	public static final String STATUS = "status";
	public static final String ADD_TIME = "add_time";

}
